package com.mes.controller;


import com.mes.entity.Energy;
import com.mes.service.EnergyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @BelongsPackage: com.mes.controller
 * @Author: 源源瞬转
 * @CreateTime: 2024-09-18  09:43
 * @Description TODO:
 */
@RequestMapping("/EnergyController")
@RestController
public class EnergyController {

    @Autowired
    private EnergyService energyService;

    @GetMapping("/listByLike")
    public List<Energy> listByLike(@RequestParam(required = false) String name, @RequestParam(required = false) String address) {

        System.out.println(111);
        return energyService.listByLike(name, address);

    }

    @DeleteMapping("/removeById")
    public int removeById(String id) {
        return energyService.removeById(id);

    }

    @PutMapping("updateById")
    public int updateById(@RequestBody Energy energy) {
        return energyService.updateById(energy);
    }

    @PostMapping("/insertEnergy")
    public int insertEnergy(@RequestBody Energy energy) {
        return energyService.insertEnergy(energy);
    }

}